package com.healer.common;


import com.healer.pojo.InfoMsg;
import com.healer.pojo.ReturnBody;


/**
 * 功能描述：封装ResponseBody的内容
 */
public class AssembleResponseMsg {
    public <T> ReturnBody success(T data) {
        ReturnBody<T> resp = new ReturnBody<>();
        resp.setData(data);
        InfoMsg info = new InfoMsg();
        resp.setInfo(info);
        return resp;
    }

    public <T> ReturnBody failure(int status, String errorCode, String message) {
        ReturnBody<T> resp = new ReturnBody<>();
        resp.setStatus(status);
        InfoMsg info = new InfoMsg();
        info.setCode(errorCode);
        info.setMessage(message);
        resp.setInfo(info);
        return resp;
    }
}
